import type { MenuItemType } from "../store/authStore";

// 登录请求参数
export interface LoginParams {
    username: string;
    password: string;
}

// 通用时间戳字段，几乎所有表都有
export interface Timestamps {
    created_at: Date;
    updated_at: Date;
}

/**
 * 通用状态枚举
 * ACTIVE  激活
 */
export const Status = {
    ACTIVE: 1,
    INACTIVE: 0
} as const

export type Status = typeof Status[keyof typeof Status];

// 用户角色枚举 - 新增职员角色
export const UserRole = {
    SUPER_ADMIN: 'super_admin',
    MANUFACTURER_ADMIN: 'manufacturer_admin',
    STAFF: 'staff' // 厂商职员
} as const
export type UserRole = typeof UserRole[keyof typeof UserRole];
// 学生支付状态枚举
export const PaymentStatus = {
    PAID: 'paid',
    UNPAID: 'unpaid',
    PENDING: 'pending'
} as const
export type PaymentStatus = typeof PaymentStatus[keyof typeof PaymentStatus];

// 厂商 (Manufacturers)
export interface Manufacturer extends Timestamps {
    id: number;
    name: string;
    contact_person: string;
    contact_phone: string;
    address: string;
    status: Status;
}


// 登录响应数据
export interface LoginResponse {
    token: string;
    user: {
        id: number;
        username: string;
        password: string; // 存储的是加密后的哈希值
        realname: string;
        phone: string;
        email: string;
        role: UserRole;
        role_id: number;
        manufacturer_id: number | null; // 超级管理员此字段为 NULL
        status: Status;
        last_login_at: string | null;
        // 关联查询时可能需要的字段
        manufacturer?: Manufacturer | null;
    }
}



// 通用API响应格式
export interface ApiResponse<T = any> {
    code: number;
    message: string;
    data: T;
}